<?php
  /*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License
  
  Based on Extra images 1.4 from Mikel Williams
  Thanks to Mikel Williams, StuBo, moosey_jude and Randelia
  Modifications: Xav xpavyfr@yahoo.fr

  */


$products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
if (tep_db_num_rows($products_extra_images_query) >= 1){
	$rowcount_value=4;  //number of extra images per row	
	$rowcount=1;
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      	<TR>
	  <TD>
	    
      </td>
    </tr>
	      
	<TR>
	  <TD>
	    <table border="0" width="100%" cellspacing="1" cellpadding="2">
	      <TR>
<?php	
					
	//$products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
	while ($extra_images = tep_db_fetch_array($products_extra_images_query)) {
	
              if (IMAGE_LIGHTBOX == 'true') {
             
?>
		<TD align ="center" class="imgextra">
		
		<?php echo '<a href="' . DIR_WS_IMAGES . $extra_images['products_extra_image'] . '" rel="lightbox['.$product_info['products_name'].']">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
		
		</td>
<?php

}else{
?>
		<TD align ="center" class="imgextra">
		<SCRIPT language="javascript"><!--
		document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_EXTRA_IMAGES, 'peiID=' . $extra_images['products_extra_images_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], addslashes($product_info['products_name']),SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
		//--></SCRIPT>
		<NOSCRIPT>
		<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $extra_images['products_extra_image']) . '">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
		</NOSCRIPT>
		</td>
<?php
}
	if ($rowcount == $rowcount_value){echo '</tr><tr>'; $rowcount=1;}
	else {$rowcount=$rowcount+1;}
	}
	
?>	
	   </tr>
	</TABLE>
      </td>
    </tr>

<?php
}
?>    
